#include "Resources.h"
#include "OgreVector3.h"
#include "OgreMovableObject.h"
#pragma once

namespace UniverseSound
{
	class Listener : public Ogre::MovableObject
	{
	public:
		Listener() : mLocalTransformDirty(false), mPosition(Ogre::Vector3::ZERO)
		{
			for (int i = 0; i < 6; i++)
				mOrientation[i] = 0;
		};
		
		//void setListenerVolume(ALfloat vol = 1.0);
		//ALfloat getListenerVolume();
		
		void setVelocity(float velx, float vely, float velz);
		void setVelocity(const Ogre::Vector3 &vel);
		void setPosition(ALfloat x, ALfloat y, ALfloat z);
		void setPosition(const Ogre::Vector3 &pos);
		const Ogre::Vector3& getPosition();
		void setOrientation(ALfloat x, ALfloat y, ALfloat z, ALfloat upx, ALfloat upy, ALfloat upz);
		void setOrientation(const Ogre::Quaternion& q);
		Ogre::Vector3 getOrientation();
		
		void update();

		virtual const Ogre::String& getMovableType() const;
		virtual const Ogre::AxisAlignedBox& getBoundingBox() const;
		virtual Ogre::Real getBoundingRadius() const;
		
		virtual void _updateRenderQueue(Ogre::RenderQueue *queue);

		virtual void visitRenderables(Ogre::Renderable::Visitor *visitor, bool debugRenderables);
		virtual void _notifyAttached(Ogre::Node *node, bool isTagPoint = false);
		virtual void _notifyMoved();

	private:
		Ogre::Vector3 mPosition;
		Ogre::Vector3 mVelocity;
		float mOrientation[6];
		bool mLocalTransformDirty;
	};
}